﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DaInterFace;
using DaInterFace.PDA;

namespace DaFunction.PDA
{
    internal class PDA : IPDA
    {
        public event PDAMessageHandler MessageEvent;

        public IDataBase Data { get { return data; } }
        public IXML XML { get { return xml; } }
        public IConfig Config { get { return config; } }

        private IDataBase data;
        private IXML xml;
        private IConfig config;

        public PDA(IDataBase data, IConfig config)
        {
            this.data = data;
            this.xml = new PDAXML();
            this.config = new PDAConfig(config);
        }

        public void Message(MessageType type, String note)
        {
            Message(type, note, 0);
        }

        public void Message(MessageType type, String note, Double span)
        {
            if (MessageEvent != null)
            {
                MessageEvent.Invoke(type, note, span);
            }
        }
    }
}
